package org.example.trainTicketSystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.example.trainTicketSystem.entity.RefundRecord;
import org.example.trainTicketSystem.mapper.RefundRecordMapper;
import org.example.trainTicketSystem.service.RefundRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class RefundRecordServiceImpl extends ServiceImpl<RefundRecordMapper,RefundRecord> implements RefundRecordService {

    @Autowired
    private RefundRecordMapper refundRecordMapper;

    @Override
    public Page<RefundRecord> getRefundRecordsBySaleId(int saleId, int page, int size) {
        Page<RefundRecord> refundRecordPage=new Page<>(page, size);
        QueryWrapper<RefundRecord> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("sale_id", saleId);
        return refundRecordMapper.selectPage(refundRecordPage,queryWrapper);
    }
}
